<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
<script type="text/javascript" charset="utf-8" src="/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" charset="utf-8" src="/My97DatePicker/WdatePicker.js"></script>

<style>
    #login-button{
        background: #286090!important;
        color: white!important;
        border: 1px solid #286090!important;
        border-radius: 3px;
    }
</style>
<div class="span10">
    <div style="margin-bottom: 20px;">
        <a href="/index/index">首页</a>
        <span >&gt;</span>
        <span>活动管理</span>
        <span >&gt;</span>
        <span>添加</span>
    </div>
    <form class="form" method="post" action="<?php echo baseUrl."/content/active/add"?>" enctype="multipart/form-data">
        <table>
            <tr>
                <td>活动名称 *</td>
                <td ><input type="text" style="width: 600px;" name="name" placeholder="" value="<?php echo isset($data)? $data['name']:''?>"/></td>
            </tr>
            <?php if(isset($data)) {
                $str = '<tr>';
                $str .= '<td>原图片:</td>';
                $str .= '<td>';
                $pic = $data['pic'];
                $str .= "<input name='pic' type='text' value='" . $pic . "'></td></tr>";
                echo $str;
            } ?>

            <tr>
                <td>封面图 *:</td>
                <td>
                    <input id="file" type="file" name="pic" >
                </td>
            </tr>
            <tr>
                <td>
                    选择分类 *：
                </td>
                <td>
                    <select name="cate" id="cate">
                        <option value="">请选择类型</option>
                        <option value="1" <?php echo isset($data['cate']) && $data['cate'] == "1" ? 'selected=selected' : '' ?>>公开课</option>
                        <option value="2" <?php echo isset($data['cate']) && $data['cate'] == "2" ? 'selected=selected' : '' ?>>训练营</option>
                        <option value="3" <?php echo isset($data['cate']) && $data['cate'] == "3" ? 'selected=selected' : '' ?>>免费试听</option>
                        <option value="4" <?php echo isset($data['cate']) && $data['cate'] == "4" ? 'selected=selected' : '' ?>>抽奖活动</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>主办方 *</td>
                <td ><input type="text" style="width: 600px;" name="sponsor" placeholder="" value="<?php echo isset($data)? $data['sponsor']:''?>"/></td>
            </tr>
            <tr>
                <td>地点 *</td>
                <td ><input type="text" style="width: 600px;" name="place" placeholder="" value="<?php echo isset($data)? $data['place']:''?>"/></td>
            </tr>
            <tr>
                <td>活动时间 *</td>
                <td>
                    <input class="input-small Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:00'})" type="text" style="width: 150px;" name="startTime" value="<?php echo isset($data['startTime']) ? $data['startTime'] : '' ?>"/> - <input style="width: 150px;" class="input-small Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:00'})" size="20" type="text" name="endTime" value="<?php echo isset($data) ? $data['endTime'] : '' ?>"/>
                </td>

            </tr>
            <tr>
                <td>报名数 *</td>
                <td ><input type="text" style="width: 600px;" name="reservations" placeholder="" value="<?php echo isset($data)? $data['reservations']:''?>"/></td>
            </tr>
            <tr>
                <td>浏览量</td>
                <td ><input type="text" style="width: 600px;" name="viewCount" placeholder="" value="<?php echo isset($data)? $data['viewCount']:''?>"/></td>
            </tr>

            <tr>
                <td>试听sdk：</td>
                <td><input type="text" style="width: 600px;" name="url" placeholder="" value="<?php echo isset($data)? $data['url']:''?>"/></td>
            </tr>

            <tr>
                <td>老师：</td>
                <td><input type="text" style="width: 600px;" name="teacher" placeholder="" value="<?php echo isset($data)? $data['teacher']:''?>"/></td>
            </tr>
            <tr>
                <td>活动标签：</td>
                <td><input type="text" style="width: 600px;" name="course_tag" placeholder="" value="<?php echo isset($data)? $data['course_tag']:''?>"/></td>
            </tr>
            <tr>
                <td>价格 *：￥</td>
                <td><input type="text"  style="width: 600px;" name="price" placeholder="课程价格" value="<?php echo isset($data)? $data['price']:''?>"/></td>
            </tr>
            <tr>
                <td>关键词 *：</td>
                <td>
                    <input type="text" id="keywords" style="width: 600px;" name="keywords" placeholder="关键词"  value="<?php echo isset($data) ? $data['keywords'] : '' ?>"/>
                </td>
            </tr>
            <tr>
                <td>课程简介*：</td>
                <td>
                    <textarea type="text/plain" name="smallintro" placeholder="课程介绍" style="height:100px;width:600px"><?php echo isset($data)? $data['smallintro']:''?></textarea>
                </td>
            </tr>
            <tr>
                <td>课程介绍 *：</td>
                <td>
                    <textarea type="text/plain" id="intro" name="introduction" placeholder="课程介绍" style="height:300px;width:700px"><?php echo isset($data) ? $data['introduction'] : '' ?></textarea>
                </td>
            </tr>
            <tr>
                <td>上传者</td>
                <td ><input type="text" style="width: 600px;" name="author" placeholder="" value="<?php echo isset($data)? $data['author']:''?>"/></td>
            </tr>

            <tr>
                <td colspan="2" align="center"> <button type="submit" id="login-button">添加课程</button></td>
            </tr>
            <input type="hidden" name='id' value="<?php echo isset($data)? $data['id']:''?>"/>
            <input type="hidden" name="_csrf" value="<?=Yii::$app->request->getCsrfToken()?>" />
        </table>
    </form>
</div>
<script>
    //实例化编辑器
//    var ue = UE.getEditor('editor');
//    var plan = UE.getEditor('plan');
    var intro = UE.getEditor('intro');
</script>